package org.waveplayer.section;

import androidx.annotation.NonNull;

import org.waveplayer.section.decoration.Section;
import org.waveplayer.section.decoration.SectionProvider;

import java.util.HashMap;
import java.util.List;

public class DataSelectionProvider extends SectionProvider<Data> {

    public DataSelectionProvider(List<Data> data) {
        super(data);
    }

    @Override
    @NonNull
    protected Section getSectionImpl(@NonNull HashMap<String, Section> storeMap, int position, @NonNull Data data) {
        Section section = storeMap.get(data.date);
        if (section == null) {
            section = new Section(data.date, data.date);
            storeMap.put(data.date, section);
        }
        return section;
    }
}
